import Vue from 'vue'
import Vuex from 'vuex'
 
import createPersistedState from "vuex-persistedstate"

Vue.use(Vuex)
 
const store = new Vuex.Store({
    state: {
      userInfo:"",
      count: 1,
      token:"x"
    },
    mutations: {
        addCount(state,num){
            state.count += num
        },
        setUserInfo(state,val){
          state.userInfo = val;
        },
        setToken(state,val){
            state.token = val;
        },
    },
    actions: {

    },
    plugins: [createPersistedState({
      storage:window.sessionStorage,key:'subapp31_vuex'
  })]
  });

  export default  store